<?php
defined('IN_YuLin') || exit('NO PERMIT!');
$table = Table('user_mail');
//删除
if($a == 'del'){
    !is_array($_POST['del_ids']) and $ids = explode(',', $_POST['del_ids']);
    foreach($_POST['del_ids'] as $key => $val) $ids[$key] = intval($val);
    $db->exec('DELETE FROM '.$table.' WHERE id in ('.implode(",", $ids).')');
    AjaxReturn(['status'=>'1','msg'=>'删除成功']);
}
//列表
$where = " FROM ".$table." WHERE 1=1";
$_POST['recipient'] and $recipient = $_POST['recipient'] and $where .= " and recipient like '%".NoBadStr($recipient)."%'";
$_POST['title'] and $title = $_POST['title'] and $where .= " and title like '%".NoBadStr($title)."%'";
$_POST['is_read'] and $is_read = $_POST['is_read'] and $where .= " and is_read = ".NoBadStr($is_read);
$tmp = $db->getrow('SELECT COUNT(1) AS p '.$where);
$page = max(1,intval($_GET['page']));
$size = 20;
$limit    = ' LIMIT '.($page - 1) * $size.','.$size;
$url = '?m='.$m.'&c='.$c.'&a='.$a;
$orderby = ' ORDER BY id ASC ';
$data = $db->getall('SELECT * '.$where.$orderby.$limit);
$multi = Multi($url,$page,$tmp['p'],$size);

$tpl->display($m.'/'.$c);




?>